<?php

$id = $_GET["id"];

if (empty($id)) {
  die('This page really wants a fighter ID to be useful');
}

require_once('config.php');

$con = mysql_connect($dbhost,$dbuser,$dbpassword);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($dbname, $con);

$sql = 'select f.name, a.expiration_date from fighter_authorizations as a, martial_forms as f '
	 . 'where a.martial_form_id = f.id and a.suspended = 0 and a.person_id = '.$id;
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
    if (empty($row['expiration_date']) || (time() <= strtotime($row['expiration_date']))) {
		print $row['name'].'<br />';
	} else {
		print '<span class="expired">'.$row['name'].' (expired)</span><br />';
	}
}

?>